package com.diandian.backend.log.param;

import com.diandian.base.boot.starter.exception.DefaultException;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.diandian.backend.log.dto.LogRecordPageParamDTO;

import java.io.Serializable;
import java.util.Date;

public class LogRecordPageParam implements Serializable {

	private Integer pageNum;
	private Integer pageSize;
	private String clientIdEql;
	private String clientIdLike;
	private String businessTypeEql;
	private String businessTypeLike;
	private String businessIdEql;
	private String businessIdLike;
	private String contentEql;
	private String contentLike;
	private String levelEql;
	private String levelLike;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTimeBefore;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTimeAfter;
	private Integer del;

	public void check(){
		if(this.pageNum == null || this.pageNum < 1 || this.pageSize == null || this.pageSize < 1){
			throw new DefaultException("分页参数不合法");
		}
	}

	public LogRecordPageParamDTO toDTO(){
		LogRecordPageParamDTO result = new LogRecordPageParamDTO();
		result.setPageNum(this.pageNum);
		result.setPageSize(this.pageSize);
		result.setClientIdEql(this.clientIdEql);
		result.setClientIdLike(this.clientIdLike);
		result.setBusinessTypeEql(this.businessTypeEql);
		result.setBusinessTypeLike(this.businessTypeLike);
		result.setBusinessIdEql(this.businessIdEql);
		result.setBusinessIdLike(this.businessIdLike);
		result.setContentEql(this.contentEql);
		result.setContentLike(this.contentLike);
		result.setLevelEql(this.levelEql);
		result.setLevelLike(this.levelLike);
		result.setCreateTimeBefore(this.createTimeBefore);
		result.setCreateTimeAfter(this.createTimeAfter);
		result.setDel(this.del);
		return result;
	}

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public String getClientIdEql() {
		return clientIdEql;
	}
	public void setClientIdEql(String clientIdEql) {
		this.clientIdEql = clientIdEql;
	}
	public String getClientIdLike() {
		return clientIdLike;
	}
	public void setClientIdLike(String clientIdLike) {
		this.clientIdLike = clientIdLike;
	}
	public String getBusinessTypeEql() {
		return businessTypeEql;
	}
	public void setBusinessTypeEql(String businessTypeEql) {
		this.businessTypeEql = businessTypeEql;
	}
	public String getBusinessTypeLike() {
		return businessTypeLike;
	}
	public void setBusinessTypeLike(String businessTypeLike) {
		this.businessTypeLike = businessTypeLike;
	}
	public String getBusinessIdEql() {
		return businessIdEql;
	}
	public void setBusinessIdEql(String businessIdEql) {
		this.businessIdEql = businessIdEql;
	}
	public String getBusinessIdLike() {
		return businessIdLike;
	}
	public void setBusinessIdLike(String businessIdLike) {
		this.businessIdLike = businessIdLike;
	}
	public String getContentEql() {
		return contentEql;
	}
	public void setContentEql(String contentEql) {
		this.contentEql = contentEql;
	}
	public String getContentLike() {
		return contentLike;
	}
	public void setContentLike(String contentLike) {
		this.contentLike = contentLike;
	}
	public String getLevelEql() {
		return levelEql;
	}
	public void setLevelEql(String levelEql) {
		this.levelEql = levelEql;
	}
	public String getLevelLike() {
		return levelLike;
	}
	public void setLevelLike(String levelLike) {
		this.levelLike = levelLike;
	}
	public Date getCreateTimeBefore() {
		return createTimeBefore;
	}
	public void setCreateTimeBefore(Date createTimeBefore) {
		this.createTimeBefore = createTimeBefore;
	}
	public Date getCreateTimeAfter() {
		return createTimeAfter;
	}
	public void setCreateTimeAfter(Date createTimeAfter) {
		this.createTimeAfter = createTimeAfter;
	}
	public Integer getDel() {
		return del;
	}
	public void setDel(Integer del) {
		this.del = del;
	}
}
